#ifndef YIJUGENERATOROBJECT_H
#define YIJUGENERATOROBJECT_H

#include "generatorobject.h"
#include <QThread>

class YiJuGeneratorObject : public GeneratorObject
{
    Q_OBJECT
public:
    explicit YiJuGeneratorObject(QObject *parent = 0);

signals:

public slots:
    void onPowerOn() { serialPort->write("PON\r"); }
    void onPowerOff() { serialPort->write("POF\r"); }

    void onSetRFR() { serialPort->write("RFR\r"); }
    void onSetMsMode(bool checked) { if (checked) serialPort->write("ETMS\r"); }
    void onSetMxMode(bool checked) { if (checked) serialPort->write("ETMAS\r"); }
    void onSetFCL(bool checked) { if (checked) serialPort->write("FCL\r"); }
    void onSetFCS(bool checked) { if (checked) serialPort->write("FCS\r"); }

    void onKvInc() { serialPort->write("KV+\r"); }
    void onKvDec() { serialPort->write("KV-\r"); }
    void onKvValue(const double &kv) { serialPort->write(QString("KV %1\r").arg(kv).toLatin1()); QThread::msleep(50); }

    void onMaInc() { serialPort->write("MA+\r"); }
    void onMaDec() { serialPort->write("MA-\r"); }
    void onMaValue(const double &ma) { serialPort->write(QString("MA %1\r").arg(ma).toLatin1()); QThread::msleep(50); }

    void onMsInc() { serialPort->write("MS+\r"); }
    void onMsDec() { serialPort->write("MS-\r"); }
    void onMsValue(const double &ms) { serialPort->write(QString("MS %1\r").arg(ms).toLatin1()); QThread::msleep(50); }

    void onMxInc() { serialPort->write("MX++\r"); }
    void onMxDec() { serialPort->write("MX--\r"); }
    void onMxValue(const double &mx) { serialPort->write(QString("MX %1\r").arg(mx).toLatin1()); QThread::msleep(50); }

    void onSetRFF() { serialPort->write("RFF\r"); }
    void onFKvInc() { serialPort->write("FKV+\r"); }
    void onFKvDec() { serialPort->write("FKV-\r"); }
    void onFMaInc() { serialPort->write("FMA+\r"); }
    void onFMaDec() { serialPort->write("FMA-\r"); }
    void onSetIBS() { serialPort->write("IBS\r"); }
    void onResetFSec() { serialPort->write("FRST\r"); }

    void onSetAEC() { serialPort->write("AEC\r"); }
    void onDenInc() { serialPort->write("DEN+\r"); }
    void onDenDec() { serialPort->write("DEN-\r"); }
    void onSetFIL() { serialPort->write("FIL\r"); }
    void onSetFIC() { serialPort->write("FIC\r"); }
    void onSetFIR() { serialPort->write("FIR\r"); }

private:
    void analysisData();
};

#endif // YIJUGENERATOROBJECT_H
